
package com.rasenhund.android.grecorder.activity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

import com.rasenhund.android.grecorder.R;
import com.rasenhund.android.grecorder.common.Const;

/**
 * カテゴリ選択画面
 */
public class SelectCategoryActivity extends ConfirmBaseActivity {
    @SuppressWarnings("unused")
    private static final String TAG = SelectCategoryActivity.class.getSimpleName();
    private final SelectCategoryActivity self = this;

    /********************
     * Override Method
     ********************/
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.select_category);

        // Viewの初期化
        initView();

    }

    /********************
     * EventListener
     ********************/
    /**
     * 格ボタン押下時のEventListener
     */
    final OnClickListener btnGrapp_OnClickListener = new OnClickListener() {
        @Override
        public void onClick(View v) {
            mAppData.setCategory(Const.CATEGORY.GRAPP);
            jumpNext();
        }
    };

    /**
     * 近ボタン押下時のEventListener
     */
    final OnClickListener btnProx_OnClickListener = new OnClickListener() {
        @Override
        public void onClick(View v) {
            mAppData.setCategory(Const.CATEGORY.PROX);
            jumpNext();
        }
    };

    /**
     * 射ボタン押下時のEventListener
     */
    final OnClickListener btnShoot_OnClickListener = new OnClickListener() {
        @Override
        public void onClick(View v) {
            mAppData.setCategory(Const.CATEGORY.SHOOT);
            jumpNext();
        }
    };

    /**
     * 遠ボタン押下時のEventListener
     */
    final OnClickListener btnCannon_OnClickListener = new OnClickListener() {
        @Override
        public void onClick(View v) {
            mAppData.setCategory(Const.CATEGORY.CANNON);
            jumpNext();
        }
    };

    /**
     * 狙ボタン押下時のEventListener
     */
    final OnClickListener btnSnipe_OnClickListener = new OnClickListener() {
        @Override
        public void onClick(View v) {
            mAppData.setCategory(Const.CATEGORY.SNIPE);
            jumpNext();
        }
    };

    /********************
     * Method
     ********************/
    /**
     * Viewの初期化
     */
    private void initView() {

        Button btnGrapp = (Button) findViewById(R.id.btnGrapp);
        btnGrapp.setOnClickListener(btnGrapp_OnClickListener);

        Button btnProx = (Button) findViewById(R.id.btnProx);
        btnProx.setOnClickListener(btnProx_OnClickListener);

        Button btnShoot = (Button) findViewById(R.id.btnShoot);
        btnShoot.setOnClickListener(btnShoot_OnClickListener);

        Button btnCannon = (Button) findViewById(R.id.btnCannon);
        btnCannon.setOnClickListener(btnCannon_OnClickListener);

        Button btnSnip = (Button) findViewById(R.id.btnSnip);
        btnSnip.setOnClickListener(btnSnipe_OnClickListener);

    }

    /**
     * 次の画面へ遷移
     * 
     * @param category
     */
    private void jumpNext() {

        Intent intent = new Intent(self, SelectResultActivity.class);
        startActivity(intent);

    }

}
